#include "linglongmetainfomainwindow.h"
#include "ui_linglongmetainfomainwindow.h"

#include <httpclient.h>

LingLongMetaInfoMainWindow::LingLongMetaInfoMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::LingLongMetaInfoMainWindow)
{
    ui->setupUi(this);

    auto url = "https://mirror-repo-linglong.deepin.com/api/v0/web-store/apps??page=1&size=10000";
    auto list = HttpClient::instance().get(url).toMap().value("data").toMap().value("list").toList();
    qDebug() << list.count();
    qDebug() << "id:"          << list.at(0).toMap().value("id").toInt();
    qDebug() << "appId:"       << list.at(0).toMap().value("appId").toString();
    qDebug() << "name:"        << list.at(0).toMap().value("name").toString();
    qDebug() << "version:"     << list.at(0).toMap().value("version").toString();
    qDebug() << "arch:"        << list.at(0).toMap().value("arch").toString();
    qDebug() << "icon:"        << list.at(0).toMap().value("icon").toString();
    qDebug() << "description:" << list.at(0).toMap().value("description").toString();
}

LingLongMetaInfoMainWindow::~LingLongMetaInfoMainWindow()
{
    delete ui;
}
